home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 06 - 1990 / 06.01 Jan 90 / DLL Source Code / SampDD.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-08-27  |  1.5 KB  |  58 lines  |  [TEXT/MPS ]

  1. /************************************************/
  2. /*                  Sample DLL's                */
  3. /*       Copyright © Vincent Parsons 1989.      */
  4. /************************************************/
  5. /*    DLL code for MPW C 3.0 or THINK C 4.0     */
  6. /*       with Excel for the Macintosh 2.2       */
  7. /*             and Microsoft C 5.1              */
  8. /*          with Excel for Windows 2.1          */
  9. /************************************************/
  10. /* SampDD is an example of one data type D      */
  11. /* input and one data type D output.  The       */
  12. /* output has all upper case letters converted  */
  13. /* to lower case and vice versa.  The answer    */
  14. /* has been stored in the Excel buffer used by  */
  15. /* the input variable.                          */
  16. /************************************************/
  17. /*   =REGISTER("SampDLLs","SampDD","DD")        */
  18. /*   for both the Mac and the PC.               */
  19. /************************************************/
  20.  
  21. #include "DLL.h"
  22.  
  23. #if applec
  24. #include <Types.h>
  25.  
  26. #elif MSDOS
  27. #include <windows.h>
  28.  
  29. #endif
  30.  
  31. #if THINK_C
  32. pascal char * main(char * c1);    /* prototype */
  33.  
  34. pascal char * main(c1)
  35. char * c1;
  36.  
  37. #elif applec
  38. pascal char * SampDD(char * c1)
  39.  
  40. #elif MSDOS
  41. char far * far pascal SampDD(char far * c1)
  42. #endif
  43. {
  44.     short i = 1;
  45.     
  46.     while ( i <= c1[0] ) {    /* P String */
  47.         if ((c1[i] >= 'A') && (c1[i] <= 'Z'))
  48.             c1[i] += 32;
  49.         else if ((c1[i] >= 'a') && (c1[i] <= 'z'))
  50.             c1[i] -= 32;
  51.         i++;
  52.     }
  53.     
  54.     return (c1);
  55. }
  56.  
  57. /************************************************/
  58.